<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Star(name,age,sex){
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.sing = function(song){
                console.log(song);
            }
            //构造函数不需要返回值
        }
        var ldh = new Star('刘德华',18,'男');
        console.log(ldh.name);
        console.log(ldh.age);
        console.log(ldh.sex);
        ldh.sing('冰雨');

        var zxy = new Star('张学友',18,'男');
        console.log(zxy.name);
        console.log(zxy.age);
        console.log(zxy.sex);
        zxy.sing('李香兰');
    </script>
</body>
</html>